﻿using System.Collections.Generic;

using MonPocGarage.ArmyContracts;
using MonPocGarage.ArmyContracts.Common;
using MonPocGarage.ArmyContracts.Common.Enums;
using MonPocGarage.ArmyContracts.Common.Stats;

namespace MonPocGarage.DevApp.Helpers
{
    public static class BuildArmy
    {
        public static Army BuildSmallArmy()
        {
            Army buildArmy = new Army();
            buildArmy.AddMonster(BuildDefenderX());
            buildArmy.AddUnit(BuildGruntStrikeFighter());
            return buildArmy;
        }

        private static Unit BuildGruntStrikeFighter()
        {
            return new Unit
                       {
                           Agenda = Agenda.Protectors,
                           EnergyType = EnergyType.Mechanical,
                           Faction = Faction.GUARD,
                           UnitName = "G1 Strike Fighter",
                           UnitType = UnitType.Grunt,
                           Stats = new StatBlock
                                       {
                                           Blast = new BlastStat
                                                       {
                                                           ActionDice = 1,
                                                           BoostDice = 1,
                                                           BlastRange = BlastRange.Short
                                                       },
                                           Brawl = new BrawlStat
                                                       {
                                                           ActionDice = 0,
                                                           BoostDice = 0
                                                       },
                                                       Defense = 2,
                                                       Speed = 8
                                       },
                                Abilities = BuildGruntStrikeAbilities()
                       };
        }

        private static List<IAbility> BuildGruntStrikeAbilities()
        {
            List<IAbility> abilityList = new List<IAbility>();
            //abilityList.Add(new Skill("Flight", @"This figure may move through figures and treats all terrain as open terrain. This figure is immune to hazards when moving through or occupying hazards. This figure still suffers all effects as a result of colliding with hazards and other figures. A unit without flight cannot make brawl attacks against this figure unless the attacker has an ability that allows it to do so. This figure cannot hold objective spaces and does not benefit from cover.", AbilityColor.Black, SkillType.Movement));
            //abilityList.Add(new Skill("Indirect Fire", @"Attacks made by this figure ignore cover.", AbilityColor.Black, SkillType.Debuffing));
            return abilityList;
        }

        private static Monster BuildDefenderX()
        {
            return new Monster
                       {
                           MonsterName = "Defender X",
                           Agenda = Agenda.Protectors,
                           EnergyType = EnergyType.Mechanical,
                           Faction = Faction.GUARD,
                           Health = 5,
                           HyperCost = 0,
                           MonsterType = MonsterType.Alpha,
                           Power = new PowerStat
                                       {
                                           ActionDice = 6,
                                           BoostDice = 2
                                       },
                           Stats = new StatBlock
                                       {
                                           Blast = new BlastStat
                                                       {
                                                           ActionDice = 7,
                                                           BoostDice = 3,
                                                           BlastRange = BlastRange.Short
                                                       },
                                           Brawl = new BrawlStat
                                                       {
                                                           ActionDice = 7,
                                                           BoostDice = 3
                                                       },
                                           Defense = 7,
                                           Speed = 7
                                       },
                           Abilities = BuildDefXAlphaAbilities()
                       };
        }

        private static List<IAbility> BuildDefXAlphaAbilities()
        {
            List<IAbility> abilityList = new List<IAbility>();
            //abilityList.Add(new Skill("Force Field", @"This unit gains +1 DEF against blast attacks.", AbilityColor.Blue, SkillType.Defensive));
            //abilityList.Add(new Skill("Jump", @"This figure can move through figures, treats all Terrain as open terrain, and is immune to hazards on which it does not end its advancement. It still suffers collision effects from hazards and figures. This unit cannot end its movement on impassible terrain. This unit can make brawl attacks against a figure with flight.", AbilityColor.Black, SkillType.Movement));
            //abilityList.Add(new Trigger("Energy Drain (Blast)", @"Target Monster's controller moves 1 A-dice from his/her monster pool to his/her unit pool.", AbilityColor.Black, TriggerType.Offensive));
            //abilityList.Add(new Skill("Safeguard", @"If you are securing 1 or more buildings when you power up , gain +1 p-die.", AbilityColor.Black, SkillType.Economy));
            return abilityList;
        }
    }
}
